import request from '@/utils/request'
// import qs from 'qs'

// 获取系统（内置）字典分页
export const getSysDictList = params => {
  return request({
    url: `/dict/sysList`,
    method: 'get',
    params
  })
}

// 获取业务（非内置）字典分页
export const getBusDictList = params => {
  return request({
    url: `/dict/list`,
    method: 'get',
    params
  })
}

// 添加父级字典
export const addPidDict = data => {
  return request({
    url: `/dict`,
    method: 'post',
    data
  })
}
// 修改父级字典
export const editPidDict = data => {
  return request({
    url: `/dict`,
    method: 'put',
    data
  })
}

// 根据id获取父级字典信息
export const getDictInfo = id => {
  return request({
    url: `/dict/${id}`,
    method: 'get'
  })
}

// 删除字典
export const deleteDictById = id => {
  return request({
    url: `/dict/${id}`,
    method: 'delete'
  })
}

// 维护子级字典
export const updateChildrenDict = (data,pid) => {
  return request({
    url: `/dict/saveChild/${pid}`,
    method: 'post',
    data
  })
}

// 根据父编码获取子级字典列表
export const getChildrenDictByCode = parentCode => {
  return request({
    url: `/dict/children/${parentCode}`,
    method: 'get'
  })
}
// 根据父id获取子级字典列表
export const getChildrenDictByPid = pid => {
  return request({
    url: `/dict/childs/${pid}`,
    method: 'get'
  })
}







